#将选择了boss的玩家挂在空中
execute as @a[tag=BossSelectFinish] at @s run tp @s ~ 200 ~

#实时更新BOSS血量
execute if entity @a[tag=BossAlready] store result bossbar minecraft:boss value run data get entity @a[tag=BossAlready,limit=1] Health

#提示玩家倒计时：快捷栏
execute if score ChangeBossTiming System matches 1.. as @a[tag=BossSelectFinish] run title @s actionbar [{"text":"即将在","color":"white","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"System","name":"ChangeBossTiming"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"秒后选择一位玩家成为","color":"white","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"魔王","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"加入战场","color":"white","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]

#魔王自带发光
effect give @a[tag=BossAlready,nbt=!{ActiveEffects:[{Id:14b}]}] glowing 1 0 true

#有魔王在战场 其他人自动组队
execute if entity @a[tag=BossAlready] run team join VSBOSS @a[tag=!BossAlready] 

#魔王死亡后解散组队 恢复bossbar
execute unless entity @a[tag=BossAlready] run team empty VSBOSS
execute if score ChangeBossTiming System matches 0 unless entity @a[tag=BossAlready] run bossbar remove boss



# execute if entity @a[tag=BossAlready,nbt={DeathTime:1s}] run


#Boss书，启用触发器
scoreboard players enable @a[nbt={SelectedItem:{id:"minecraft:written_book",tag:{Tags:["BossSelectMenu"]}}}] BossMenu
execute as @a unless data entity @s {SelectedItem:{id:"minecraft:written_book",tag:{Tags:["BossSelectMenu"]}}} run scoreboard players reset @s BossMenu

#Boss英雄选择器
execute as @a[scores={BossMenu=11..}] run function nw:system/system_util/reset


execute as @a[scores={BossMenu=11}] at @s run function nw:yingxiong/0boss/01mieshang/zhuangbei
execute as @a[scores={BossMenu=12}] at @s run function nw:yingxiong/0boss/02xiu/zhuangbei
# execute as @a[scores={BossMenu=12}] at @s run function nw:yingxiong/0boss/02xiu/zhuangbei


##TODO：以上数据复制更改即可————————————————————————————————————————————————————————————————————
# execute if entity @a[scores={BossMenu=11}] run scoreboard players set @s SystemJoin 0
tag @a[scores={BossMenu=11..}] remove Watch
tag @a[scores={BossMenu=11..}] add BossSelectFinish
scoreboard players set @a[scores={BoosMenu=1..}] BoosMenu 0



#发送boss菜单书
execute if score ChangeBossTiming System matches 1.. as @a[tag=Watch,nbt=!{Inventory:[{id:"minecraft:written_book",tag:{Tags:["BossSelectMenu"]}}]}] run function nw:system/system_module/boss_menu
execute if score ChangeBossTiming System matches 0 run clear @a minecraft:written_book{Tags:["BossSelectMenu"]}

# ,"clickEvent":{"action":"run_command","value":"/trigger BossMenu set 4"}}
